package vip.xiaonuo.common.util;

import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.datasource.FlexDataSource;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

import java.sql.SQLTimeoutException;

/**
 * 按数据源配置文件xxx.properties，临时创建数据源
 */
public class CommonDbUtil {
    public static HikariDataSource getTmpDs(String propertyFileName)  {
        try {
            //动态添加新的数据源
            HikariDataSource ds = new HikariDataSource(new HikariConfig(propertyFileName));
            return ds;
        }catch (Exception e){
            return null;
        }
    }
}
